<?php


namespace app\api\controller;
use app\api\model\Member;

class Main
{
    public function hello()
    {
        $nicheng = input('get.nicheng');
        $zhanghao = input('get.zhanghao');
        $mima = input('get.mima');
        if (empty($nicheng) || empty($zhanghao) || empty($mima)) {
            echo '请输入完整信息';
            die();
        }
        if(strlen($zhanghao)!=11){
            echo '手机号不正确';
            die();
        }
        if(strlen($mima)<=6){
            echo '密码不能小于6位';
            die();
        }
        $memberModel = new Member();
        $data =$memberModel->where('member_mobile','=',$zhanghao)->find();
        if(!empty($data)){
            echo '该号码已被注册';
            die();
        }


        $data=array();
        $data['member_mobile']=$zhanghao;
        $data['member_password']=md5($mima);
        $data['member_nickname']=$nicheng;
        $data['add_time']=time();
        $memberModel->insert($data);
        echo'注册成功';
    }
}